﻿Enum LogType
    MSG_NONE
    MSG_RECV
    MSG_SENT
    MSG_ISC
    MSG_STATUS
    MSG_SQL
    MSG_INFO
    MSG_NOTICE
    MSG_WARNING
    MSG_DEBUG
    MSG_ERROR
    MSG_FATALERROR
    MSG_HACK
    MSG_LOAD
    MSG_SDEBUG
    MSG_GMACTION
    MSG_QUERY
End Enum

Module log

    Sub log(ByVal type As LogType, Optional ByVal format As String = "")
        Select Case type
            Case LogType.MSG_NONE
                Exit Select
            Case LogType.MSG_RECV
                Console.ForegroundColor = ConsoleColor.Magenta
                Console.Write("[RECV]: ")
                Exit Select
            Case LogType.MSG_SENT
                Console.ForegroundColor = ConsoleColor.DarkMagenta
                Console.Write("[SENT]")
                Exit Select
            Case LogType.MSG_ISC
                Console.ForegroundColor = ConsoleColor.Blue
                Console.Write("[ISC]: ")
                Exit Select
            Case LogType.MSG_STATUS
                Console.ForegroundColor = ConsoleColor.DarkGreen
                Console.Write("[STATUS]: ")
                Exit Select
            Case LogType.MSG_SQL
                Console.ForegroundColor = ConsoleColor.DarkCyan
                Console.Write("[SQL]: ")
                Exit Select
            Case LogType.MSG_INFO
                Console.ForegroundColor = ConsoleColor.Green
                Console.Write("[INFO]: ")
                Exit Select
            Case LogType.MSG_NOTICE
                Console.ForegroundColor = ConsoleColor.Cyan
                Console.Write("[NOTICE]: ")
                Exit Select
            Case LogType.MSG_WARNING
                Console.ForegroundColor = ConsoleColor.Yellow
                Console.Write("[WARNING]: ")
                Exit Select
            Case LogType.MSG_DEBUG
                Console.ForegroundColor = ConsoleColor.Blue
                Console.Write("[DEBUG]: ")
                Exit Select
            Case LogType.MSG_ERROR
                Console.ForegroundColor = ConsoleColor.Red
                Console.Write("[ERROR]: ")
                Exit Select
            Case LogType.MSG_FATALERROR
                Console.ForegroundColor = ConsoleColor.DarkRed
                Console.Write("[FATAL ERROR]: ")
                Exit Select
            Case LogType.MSG_HACK
                Console.ForegroundColor = ConsoleColor.Red
                Console.Write("[HACK]: ")
                Exit Select
            Case LogType.MSG_LOAD
                Console.ForegroundColor = ConsoleColor.Blue
                Console.Write("[LOADING]: ")
                Exit Select
            Case LogType.MSG_GMACTION
                Console.ForegroundColor = ConsoleColor.Magenta
                Console.Write("[GM ACTION]: ")
                Exit Select
        End Select
        Console.ForegroundColor = ConsoleColor.White
        If (format <> "") Then
            Console.WriteLine(format)
        End If
    End Sub

End Module